var express = require('express');
var router = express.Router();
var passport=require('passport')
var communityController = require('../controllers/communityController')

//添加评论
router.post('/addComment/:uId',passport.authenticate('jwt',{session:false}), function (req, res, next) {
  communityController.addComment(req,res)
});
//获取所有人的评论
router.get('/getlist',function(req,res,next){
  communityController.getList(req,res)
})
//获取个人的所有评论
router.get('/getCommentList',function (req, res, next) {
  communityController.getCommentList(req,res)
});
//删除评论
router.delete('/delComment/:uId',passport.authenticate('jwt',{session:false}), function (req, res, next) {
  communityController.delComment(req,res)
});
//添加回复
router.post('/addReply/:uId', passport.authenticate('jwt',{session:false}),function (req, res, next) {
   communityController.addReply(req,res)
});
//获取某一条评论下的回复
router.get('/getReply/:commentId',passport.authenticate('jwt',{session:false}), function (req, res, next) {
   communityController.getReply(req,res)
});
//删除回复
router.delete('/delReply',passport.authenticate('jwt',{session:false}), function (req, res, next) {
  communityController.delReply(req,res)
});

module.exports=router
